<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <title>首页 - Blog</title>
    <link rel="stylesheet" href="./static/layui/css/layui.css">
    <link rel="stylesheet" href="./static/css/common.css">
    <style>
        .disabled {
            pointer-events: none; /* 禁用点击事件 */
            color: #ccc; /* 修改文字颜色 */
            text-decoration: none; /* 去掉下划线 */
            cursor: not-allowed; /* 显示禁用的光标 */
        }
    </style>
</head>
<body>
<header class="layui-bg-cyan">
    <nav class="layui-container">
        <div class="layui-row">
            <div class="layui-col-md2 logo">
                <a href="javascript:;"><img src="./static/images/logo.png"></a>
            </div>
            <div class="layui-col-md8 layui-hide-xs">
                <ul class="layui-nav layui-bg-cyan">
                    <li class="layui-nav-item layui-this">
                        <a href="index.html" name="首页">首页</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="caty.html?type=JavaSE" name="JavaSE">JavaSE</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="caty.html?type=DataBase" name="DataBase">DataBase</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="caty.html?type=jsp" name="JSP">jsp</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="caty.html?type=Frame" name="Frame">Frame</a>
                    </li>
                </ul>
            </div>
            <div class="layui-col-md2 layui-hide-xs userinfoBox">
                <ul class="layui-nav layui-bg-cyan">
                    <li class="layui-nav-item" lay-unselect="">
                        <a href="javascript:;"><img src="static/images/user01.png" class="layui-nav-img" id="aLogin" >Brother</a>
                        <dl class="layui-nav-child">
                            <dd><a href="main.html" class="layui-btn layui-btn-primary" id="back">返回后台</a></dd>
                            <dd><a href="login.html" class="layui-btn layui-btn-primary">退出登录</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>

        </div>
    </nav>
</header>
<div class="layui-container">
    <div class="layui-row layui-col-space20">
        <div class="layui-col-md8">
            <div class="layui-row">
                <div class="layui-col-md12">
                    <div class="layui-carousel" id="carousel">
                        <div carousel-item>
                            <div><img src="static/images/carousel -1.jpg" alt=""></div>
                            <div><img src="static/images/carousel -2.jpg" alt=""></div>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md12 margin20"></div>
                <div class="layui-col-md12" id="title1">
                    <div class="main zdbox">
                        <!--<div class="subject"><b>[置顶]</b><a href="detail.html" title="用SSM框架制作一个博客网站（响应式模板）">用SSM框架制作一个博客网站（响应式模板）</a><em>2022-12-12
                            11:53:24 发布</em></div>
                        <div class="content">我是熊五，风格迥异的四个我，有着不同的个性，不同的人格，甚至不同的职业。
                            行险解秘专注探险的我，朝阳蓬勃酷爱嘻哈的我，精工巧匠专注纹身的我，文墨生花文艺气息满满的我。
                            亦是我，亦非我，我是不一样的烟火。
                        </div>-->
                    </div>
                </div>

                <div class="layui-col-md12 margin20"></div>

                <div name="显示全部" id="title2"></div>

                <div class="layui-col-md12" id="pages"></div>
            </div>
        </div>
        <div class="layui-col-md4">
            <div class="layui-row">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">
								<span class="layui-breadcrumb" lay-separator="|">
									<a href="javascript:void(0);">联系站长</a>
								</span>
                        </div>
                        <div class="layui-card-body" id="binfo">
                            <table class="layui-table">
                                <colgroup>
                                    <col width="120">
                                    <col width="230">
                                </colgroup>
                                <tbody>
                                <tr>
                                    <td>QQ号：</td>
                                    <td>123456</td>
                                </tr>
                                <tr>
                                    <td>微信号：</td>
                                    <td>999999</td>
                                </tr>
                                <tr>
                                    <td>qq群号：</td>
                                    <td>1008611</td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md12 margin20"></div>
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">
								<span>
									热门文章
								</span>
                        </div>
                        <div class="layui-card-body">
                            <table class="layui-table" lay-skin="nob">
                                <tbody id="wenzhang">
                                <tr>
                                    <td><a href="detail.html">用SSM框架制作一个博客网站（响应式模板）</a></td>
                                </tr>
                                <tr>
                                    <td><a href="detail.html">用SSM框架制作一个博客网站（响应式模板）</a></td>
                                </tr>
                                <tr>
                                    <td><a href="detail.html">用SSM框架制作一个博客网站（响应式模板）</a></td>
                                </tr>
                                <tr>
                                    <td><a href="detail.html">用SSM框架制作一个博客网站（响应式模板）</a></td>
                                </tr>
                                <tr>
                                    <td><a href="detail.html">用SSM框架制作一个博客网站（响应式模板）</a></td>
                                </tr>
                                <tr>
                                    <td><a href="detail.html">用SSM框架制作一个博客网站（响应式模板）</a></td>
                                </tr>
                                <tr>
                                    <td><a href="detail.html">用SSM框架制作一个博客网站（响应式模板）</a></td>
                                </tr>
                                <tr>
                                    <td><a href="detail.html">用SSM框架制作一个博客网站（响应式模板）</a></td>
                                </tr>
                                <tr>
                                    <td><a href="detail.html">用SSM框架制作一个博客网站（响应式模板）</a></td>
                                </tr>
                                <tr>
                                    <td><a href="detail.html">用SSM框架制作一个博客网站（响应式模板）</a></td>
                                </tr>
                                <tr>
                                    <td><a href="detail.html">用SSM框架制作一个博客网站（响应式模板）</a></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md12 margin20"></div>
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">
								<span>
									捐助本站
								</span>
                        </div>
                        <div class="layui-card-body" style="text-align: center;">
                            <img src="static/images/qr.png" style="display: inline-block;">
                            <br/>
                            <p>无论多少，都是心意!</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 尾部 -->
<div class="footer"></div>
<footer class="layui-bg-cyan">
    <div class="layui-container">
        <div class="layui-row">
        </div>
    </div>
</footer>
</body>
<script src="./static/layui/layui.all.js"></script>
<script src="./static/js/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
    var pageNumber;
    var DataNumber;
    $.get("Blog/getNumber",function (nu) {
        DataNumber=nu;

    layui.carousel.render({
        elem: '#carousel'
        , width: '100%' //设置容器宽度
        , arrow: 'always' //始终显示箭头
        //,anim: 'updown' //切换动画方式
    });
    layui.laypage.render({
        elem: 'pages', //注意，这里的 pages 是 ID，不用加 # 号
        count: DataNumber, //数据总数，从服务端得到
        limit: 3,   //每页条数设置
        jump: function (obj, first) {
            //obj包含了当前分页的所有参数，比如：
            console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
            console.log(obj.limit); //得到每页显示的条数
            page = obj.curr;//改变当前页码
            limit = obj.limit;
            if (page===1){
                pageNumber=0;
            }else {
                pageNumber=page;
            }

            //首次不执行
            if (!first) {
                // alert('加载数据');
               pageNumber= (pageNumber-1)*3;
                $("div[name='显示全部']").empty();
                showBlog()

            }
        }
    });

    //==========================================================================================================

    //窗体加载
        $(document).ready(function () {
            showBlog();
        })
    function showBlog() {
        $.get("Blog/showAll", {"pageNumber": pageNumber}, function (rs) {
            $("[class=\"layui-col-md12]").empty();
            var blog = rs.result;
            var s = JSON.stringify(blog);
            for (var i = 0; i < blog.length; i++) {
                $("<div class=\"layui-col-md12\">\n" +
                    "                    <div class=\"main list\">\n" +
                    "                        <div class=\"subject\"><a href=\"caty.html?type=JavaSE\" class=\"caty\">[" + blog[i].type + "]</a><a href=\"detail.html\"\n" +
                    "                                                                                             title=\"用SSM框架制作一个博客网站（响应式模板）\">" + blog[i].title + "</a><em>" +
                    "                            " + blog[i].posttime + "</em></div>\n" +
                    "                        <div class=\"content layui-row\">\n" +
                    "                            <div class=\"layui-col-md4 list-img\">\n" +
                    "                                <a href=\"javascript:;\"><img src=\"./static/images/list_img.png\"></a>\n" +
                    "                            </div>\n" +
                    "                            <div class=\"layui-col-md8\">\n" +
                    "                                <div class=\"list-text\">" + blog[i].detail + "\n" +
                    "                                </div>\n" +
                    "                                <div class=\"list-stat layui-row\">\n" +
                    "\n" +
                    "                                    <div class=\"layui-col-xs3 layui-col-md3 Label\">\n" +
                    "                                        <i class=\"layui-icon layui-icon-note\"></i>\n" +
                    "                                        <a href=\"caty.html?type=JavaSE\">" + blog[i].type + "</a>\n" +
                    "\n" +
                    "                                    </div>\n" +
                    "                                    <div class=\"layui-col-xs3 layui-col-md3\">\n" +
                    "                                        <i class=\"layui-icon layui-icon-read\"></i>\n" +
                    "                                        <em>" + blog[i].clicknumber + "</em>\n" +
                    "                                    </div>\n" +
                    "\n" +
                    "                                    <div class=\"layui-col-xs3 layui-col-md3 alink\">\n" +
                    "                                        <a id='clicknumber' data-value='"+blog[i].blogid+"' href='detail.html?blogid="+blog[i].blogid+"&type="+blog[i].type+"' class=\"layui-btn layui-btn-xs\">阅读原文</a>\n" +
                    "                                    </div>\n" +
                    "                                </div>\n" +
                    "                            </div>\n" +
                    "                        </div>\n" +
                    "                    </div>\n" +
                    "                </div>" +
                    "             <div class=\"layui-col-md12 margin20\"></div>").appendTo("div[name='显示全部']");

            }
        });
    }
        $("a[name='JavaSE']").click(function () {
            var JavaSE=$(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type",JavaSE);
            window.location.href="http://127.0.0.1:8888/caty.html?type="+JavaSE;

        });

        $("a[name='DataBase']").click(function () {
            var DataBase=$(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type",DataBase);
            window.location.href="http://127.0.0.1:8888/caty.html?type="+DataBase;

        });
        $("a[name='JSP']").click(function () {
            var jsp=$(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type",jsp);
            window.location.href="http://127.0.0.1:8888/caty.html?type="+jsp;
        });
        $("a[name='Frame']").click(function () {
            var Frame=$(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type",Frame);
            window.location.href="http://127.0.0.1:8888/caty.html?type="+Frame;
        });
    });

    document.addEventListener('DOMContentLoaded', function() {
        // 查找<a>标签
        var link = document.querySelector('a');

        // 提取并输出文本部分
        if (link) {
            var text = link.textContent.trim(); // 或者使用 link.innerText
            console.log(text); // 输出: Brother
        }
    });
</script>



<!--登录页侧边热门文章列表展示，点击跳转附带blogid-->
<script type="text/javascript">
    $(document).ready(function () {
        $.get("Blog/showByClickNumber",function (rs) {
            JSON.stringify(rs);
            var wos = rs.result
            $("[id='wenzhang']").empty();
            for (var i=0; i < wos.length; i++){
                $("<tr>\n" +
                    "<td id='clicknumber' data-value='"+wos[i].blogid+"'><a href='detail.html?blogid="+wos[i].blogid+"&type="+wos[i].type+"'>"+wos[i].title+"</a></td>\n" +
                    "</tr>").appendTo("[id='wenzhang']");
            }
        });




    });

    /*设置点击事件，点击热门文章时获取blodid，并使点击数加1*/
    $(document).on("click","#clicknumber",function () {
        var blogid=$(this).data("value");
        $.get("Blog/updateClickNumber",{"blogid":blogid},function () {
        });
    });


</script>

<!--盛志健的index-->
<script type="text/javascript">

    //窗体加载
    $(document).ready(function () {
        $.get("Blog/showAll", function (rs) {
            $("[class=\"layui-col-md12]").empty();
            var blog = rs.result;
            var s = JSON.stringify(blog);
            for (var i = 0; i < blog.length; i++) {
                $("<div class=\"layui-col-md12\">\n" +
                    "                    <div class=\"main list\">\n" +
                    "                        <div class=\"subject\"><a href=\"caty.html?type=JavaSE\" class=\"caty\">[" + blog[i].type + "]</a><a href=\"detail.html\"\n" +
                    "                                                                                             title=\"用SSM框架制作一个博客网站（响应式模板）\">" + blog[i].title + "</a><em>" +
                    "                            " + blog[i].posttime + "</em></div>\n" +
                    "                        <div class=\"content layui-row\">\n" +
                    "                            <div class=\"layui-col-md4 list-img\">\n" +
                    "                                <a href=\"javascript:;\"><img src=\"static/images/list_img.png\"></a>\n" +
                    "                            </div>\n" +
                    "                            <div class=\"layui-col-md8\">\n" +
                    "                                <div class=\"list-text\">" + blog[i].detail + "\n" +
                    "                                </div>\n" +
                    "                                <div class=\"list-stat layui-row\">\n" +
                    "\n" +
                    "                                    <div class=\"layui-col-xs3 layui-col-md3 Label\">\n" +
                    "                                        <i class=\"layui-icon layui-icon-note\"></i>\n" +
                    "                                        <a href=\"caty.html?type=JavaSE\">" + blog[i].type + "</a>\n" +
                    "\n" +
                    "                                    </div>\n" +
                    "                                    <div class=\"layui-col-xs3 layui-col-md3\">\n" +
                    "                                        <i class=\"layui-icon layui-icon-read\"></i>\n" +
                    "                                        <em>" + blog[i].clicknumber + "</em>\n" +
                    "                                    </div>\n" +
                    "\n" +
                    "                                    <div class=\"layui-col-xs3 layui-col-md3 alink\">\n" +
                    "                                        <a href=\"detail.html\" class=\"layui-btn layui-btn-xs\">阅读原文</a>\n" +
                    "                                    </div>\n" +
                    "                                </div>\n" +
                    "                            </div>\n" +
                    "                        </div>\n" +
                    "                    </div>\n" +
                    "                </div>" +
                    "             <div class=\"layui-col-md12 margin20\"></div>").appendTo("div[name='显示全部']");

            }

        });
        $("a[name='JavaSE']").click(function () {
            var JavaSE = $(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type", JavaSE);
            window.location.href = "http://127.0.0.1:8888/caty.html?type=" + JavaSE;

        });

        $("a[name='DataBase']").click(function () {
            var DataBase = $(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type", DataBase);
            window.location.href = "http://127.0.0.1:8888/caty.html?type=" + DataBase;

        });
        $("a[name='JSP']").click(function () {
            var jsp = $(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type", jsp);
            window.location.href = "http://127.0.0.1:8888/caty.html?type=" + jsp;
        });
        $("a[name='Frame']").click(function () {
            var Frame = $(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type", Frame);
            window.location.href = "http://127.0.0.1:8888/caty.html?type=" + Frame;
        });
        /*置顶*/
        /*$(document).ready(function () {
            $.get("Top/showTop", function (result) {
                console.log(result);
                $("#title1").empty();
                for (var j = 0; j < result[j].length; j++) {
                    $("<div class=\"main zdbox top-detail\"  name='" + result[j].blogid + "'>\n" +
                        "<div class=\"subject\"><b>[置顶]</b><a title=\"置顶详情\"  name='" + result[j].blogid + "' >" + result[j].title + "</a><em>" + result[j].posttime + "\n" +
                        "发布</em></div>\n" +
                        "<div class=\"content\">" + result[j].detail + "\n" +
                        "</div>\n" +
                        "</div>").appendTo("#title1");
                }
            });
        });*/
        $.get("Top/showTop", function (result) {
            console.log(result);
            $("#title1").empty();
            // 检查 result 是否是数组
            if (Array.isArray(result)) {
                for (var j = 0; j < result.length; j++) {
                    var item = result[j];
                    // 确保 item 包含所需的属性
                    if (item.blogid && item.title && item.posttime && item.detail) {
                        $("<div class=\"main zdbox top-detail\"  name='" + item.blogid + "'>\n" +
                            "<div class=\"subject\"><b>[置顶]</b><a title=\"置顶详情\"  name='" + item.blogid + "' >" + item.title + "</a><em>" + item.posttime + "\n" +
                            "发布</em></div>\n" +
                            "<div class=\"content\">" + item.detail + "\n" +
                            "</div>\n" +
                            "</div>").appendTo("#title1");
                    }
                }
            } else {
                console.error("Unexpected data format:", result);
            }
        }).fail(function() {
            console.error("Failed to fetch data from server.");
        });
    });
</script>



</html>